//
//  Task.h
//  smart_transferor
//
//  Created by  on 11-11-2.
//  Copyright (c) 2011年 tencent. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreFoundation/CoreFoundation.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <unistd.h>

#import "FileMetaInfo.h"
@class SendTask;

@interface SendingConn :  NSObject  
{
    SendTask *sendTask;
    char *dstIp;
    int infd;
    int sentBytes;
    CFSocketRef _cfSocket;
    int touchTimeStamp;
}
@property (readwrite,assign) SendTask *sendTask;
@property (readwrite,assign) char *dstIp;
@property (readwrite,assign) int infd;
@property (readwrite,assign) int sentBytes;
@property (readwrite,assign) CFSocketRef _cfSocket;
@property (readwrite,assign) int touchTimeStamp;
-(id)init;
-(void)dealloc;
@end

@interface SendTask : NSObject 
{
    int sendId;
    FileMetaInfo *fileInfo;
    int startTimeStamp;
    int foundedTargets;
    int transferTargets;
    NSMutableArray *sendingConns;
}
@property (readwrite,assign) int sendId;
@property (readwrite,retain) FileMetaInfo *fileInfo;
@property (readwrite,assign) int startTimeStamp;
@property (readwrite,assign) int foundedTargets;
@property (readwrite,assign) int transferTargets;
@property (readwrite,retain)  NSMutableArray *sendingConns;
-(id)init;
-(void)dealloc;
@end

@class RecvTask;
@interface RecvingConn : NSObject 
{
    RecvTask *recvTask;
    int outfd;
    int recvLength;
    CFSocketRef _cfSocket;
    int touchTimeStamp;
}
@property (readwrite,assign) RecvTask *recvTask;
@property (readwrite,assign) int outfd;
@property (readwrite,assign) int recvLength;
@property (readwrite,assign) CFSocketRef _cfSocket;
@property (readwrite,assign) int touchTimeStamp;
-(id)init;
@end


@interface RecvTask : NSObject
{
    char *srcIp;
    int srcSendId;
    int recvId;
    FileMetaInfo *fileInfo;
    int startTimeStamp;
    RecvingConn *recvingConn;
}
@property (readwrite,assign) char *srcIp;
@property (readwrite,assign) int srcSendId;
@property (readwrite,assign) int recvId;
@property (readwrite,retain) FileMetaInfo *fileInfo;
@property (readwrite,assign) int startTimeStamp;
@property (readwrite,retain) RecvingConn *recvingConn;
-(id)init;
-(void)dealloc;
@end
